import 'package:flutter/material.dart';
import 'package:sui_shou_pai/module/top_bar.dart';
import 'package:sui_shou_pai/news/announcement/announcement_list.dart';
import 'package:sui_shou_pai/news/news/company_news_list.dart';
import 'package:sui_shou_pai/news/news/industry_news_list.dart';

import 'today/today_news_list.dart';

class NewsPage extends StatefulWidget {
  NewsPage({Key key}) : super(key: key);

  @override
  _NewsPageState createState() => _NewsPageState();
}

class _NewsPageState extends State<NewsPage> with TickerProviderStateMixin {
  String title = '资讯';
  List<Tab> tabLabels = [
    Tab(text: '今日新闻'),
    Tab(text: '公司新闻'),
    Tab(text: '行业新闻'),
    Tab(text: '公告'),
  ];

  TabController _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: tabLabels.length, vsync: this);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: initAppBar(title, tabLabels, _tabController),
      body: TabBarView(
        controller: _tabController,
        children: <Widget>[
          TodayNewsList(),
          CompanyNewsList(),
          IndustryNewsList(),
          AnnouncementList(),
        ],
      ),
    );
  }
}
